#ifndef SRF02_H_
#define SRF02_H_

#include <avr/io.h>
#include <util/twi.h>
#include "../hardware.h"
#include "../../lib/i2cmaster.h"

/*****************************************
 * Ultrasonic sensor addresses used in actual configuration
 */
//* US 1 front left
#define US_1 0xE0
//* US 2
//#define US_2 0xE2
//* US 3 front right
#define US_3 0xE4
//* US 4 rear right
#define US_4 0xE6
//* US 5 front middle
#define US_5 0xE8
//* US 6 rear left
#define US_6 0xEA

//For a Ultrasonic measurement result in centimeters (81 in 10)
#define US_Start 0x51

// The known Ultrasonic devices
const static char US_IDs[]={US_6,US_5,US_4,US_1,US_3};
const static char* US_Names[]={" rear left "," front middle "," rear right "," front left "," front right "};

//Array indices for US Sensors
const static int US_fl = 3;
const static int US_fr = 4;
const static int US_fm = 1;
const static int US_rr = 2;
const static int US_rl = 0;

// Measurement results for the ultrasonic device
extern int US_vals[ARRAY_SIZE(US_IDs)];

extern int* get_us_vals();

extern void start_all_US_Measure();

extern void read_all_US_Data();

extern void start_US_Measure(int id);

extern unsigned int read_US_Data(int id);

extern void init_i2c_bus();

extern byte Srf02_firmware(byte Slaveid);

#endif
